package cn.zust.ly.play.Exa;

import java.util.Scanner;

/**
 * Created by liy on 2016/12/1.
 */
public class Test04 {
    public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        while(true) {
            String str = sc.nextLine();
            System.out.println(getMaxContinuity(str));
        }

    }
    public static int getMaxContinuity(String s)
    {
        int max_1 = 0;
        int max_0 = 0;
        int n_1 = 0;  // 当前1连续的次数
        int n_0 = 0;  // 当前0连续的次数

        for(int i=0; i<s.length(); i++)
        {
            if(s.charAt(i)=='0')
            {
                n_0++;
                n_1=0;
            }
            else
            {
                n_1++;
                n_0=0;
            }

            if(n_1 > max_1) max_1 = n_1;
            if(n_0 > max_0) max_0 = n_0;
        }

        return max_1>max_0? max_1 : max_0;
    }
}
